ShowTable of Contents
This article will go through the steps required to set up a provided test project to test your custom XPages controls.
In this tutorial we will be using an example control project:
com.example.greenbox, but same steps can be applied to other controls.
To follow this tutorial, import the
com.example.greenbox project which can be found in the article's
Attachments list.
Configuring Test Project
In the
MANIFEST.MF in the test project, remove dependency on the
com.example.xsp project
Add a new dependency for your control (in our case it's
com.example.greenbox) so it looks like so:
In the project open
WEB-INF/xsp.properties file
Change the dependency from
com.example.library to your own (in our case it's
com.example.greenbox.library)
It should look like so:
xsp.library.depends=\
com.ibm.xsp.core.library,\
com.ibm.xsp.extsn.library,\
com.ibm.xsp.designer.library,\
com.ibm.xsp.domino.library,\
com.example.greenbox.library
Open
config.properties in the test project package
com.ibm.xsp.test.framework
Change the
target.
library and
NamingConvention.package.prefix to your own control
(in our case it's
com.example.greenbox.library and
com.example.greenbox respectively). It should look like so:
# The XspLibrary.getLibraryId() value of the library
# whose contents should be tested, defaults to none,
# meaning that only local xsp-configs are loaded.
target.library=com.example.greenbox.library
# Package name and component-type prefix, like "com.ibm.xsp" or
# "com.ibm.xsp.extlib", used in the NamingConventionTest
#NamingConvention.package.prefix=
NamingConvention.package.prefix=com.example.greenbox
# Extra libraries whose xsp-config files should be loaded
# when creating a registry
extra.library.depends.designtime.nonapplication=\
com.ibm.xsp.core.library,\
com.ibm.xsp.extsn.library,\
com.ibm.xsp.designer.library,\
com.ibm.xsp.domino.library
In the test project, open
pages/simpleTestOfExampleControl.xsp
Change the XPage(prefix, namespace, tag) to use your own control. In our case it should look like so:
Delete the contents of the
gen folder in the test project.
Re-run the tests. Refresh the test project.
gen folder should now contain generated Java Classes for the corresponding XPage above.
Before we continue to the next section, we need to fix a compile error in the
ExamplePrintTagNamesAndProps.
In the test project, open
ExamplePrintTagNamesAndProps.java from the
xsp.example.test.version package.
Somewhere around line #22 change the following code to use your own control (in our case it's Greenbox Library).
Change from:
tagsAndProps = filterToDependsLibrary(registry, (new ExampleLibrary()).getLibraryId(), tagsAndProps);
to
tagsAndProps = filterToDependsLibrary(registry, (new GreenboxLibrary()).getLibraryId(), tagsAndProps);
You might want to organize your imports (Ctrl+Shift+O) to remove unused references to the old control.